<script setup lang="ts">
import { ref } from 'vue';
import { CButton, BasicTable, useTable, TableAction } from 'hickey-ui';
import type { Recordable } from 'hickey-ui/libs/packages/typeing';
// import { CButton, BasicTable, useTable, TableAction } from '@/components';
import { columns, searchFormSchema } from './index.data';

defineOptions({ name: 'ContractSalesman' });

const ojbadata: Recordable = {};
console.log(ojbadata);
const detailLogSchemaModalRef = ref();
const [registerTable] = useTable({
  title: '个体从业者合同管理',
  columns,
  dataSource: [
    {
      id: 136,
      contractNo: 'FLBFWXY20240808-0001',
      companyNo: 'JSCY0001202408051857240001',
      companyName: '北京尧地农业科技发展有限公司',
      contractType: 1,
      signType: 1,
      externalContractNo: 'FLBFWXY20240808-0001',
      frameContractNo: null,
      frameContractName: null,
      contractStatus: 3,
      reason: null,
      expiresStart: '2024-08-08',
      expiresEnd: '2025-08-07',
      contractPath:
        'https://tyndall-saas-test.oss-cn-beijing.aliyuncs.com/jzq/pdf/jzq-contract/%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E4%B9%A6-FLBFWXY20240808-0001.pdf?Expires=1723716664&OSSAccessKeyId=LTAI5tFzSgkcjQoBsL8XCi13&Signature=2l%2FOXFbgxv7ezm2xHWS7xTmKZGo%3D',
      downloadPath: 'jzq/pdf/jzq-contract/服务协议书-FLBFWXY20240808-0001.pdf',
      mainCompanyNo: 'MC20240509001',
      mainCompanyName: '北京数字丝路智慧能源有限公司',
      mainCompanyNames: '北京数字丝路智慧能源有限公司',
      createTime: 1723087440000,
      creator: '1',
      creatorName: '超级管理员',
      taxCompanyName:
        '安徽德升容信息科技有限公司,安徽博诚鸿软件技术有限公司,安徽新荣达信息科技有限公司,安徽法尔贝数字信息科技有限公司,河南达新信息科技有限公司',
      platform: 0,
      signStatus: 2
    },
    {
      id: 135,
      contractNo: 'FLBFWXY20240807-0007',
      companyNo: 'JSCY0001202408071316360005',
      companyName: '海城市金瑞食用菌蔬菜专业合作社',
      contractType: 1,
      signType: 1,
      externalContractNo: 'FLBFWXY20240807-0007',
      frameContractNo: null,
      frameContractName: null,
      contractStatus: 3,
      reason: null,
      expiresStart: '2024-08-07',
      expiresEnd: '2025-08-06',
      contractPath:
        'https://tyndall-saas-test.oss-cn-beijing.aliyuncs.com/jzq/pdf/jzq-contract/%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E4%B9%A6-FLBFWXY20240807-0007.pdf?Expires=1723716664&OSSAccessKeyId=LTAI5tFzSgkcjQoBsL8XCi13&Signature=9E8iE6wp0mpfvnK7VfPGLTtqs20%3D',
      downloadPath: 'jzq/pdf/jzq-contract/服务协议书-FLBFWXY20240807-0007.pdf',
      mainCompanyNo: 'MC20240509001',
      mainCompanyName: '北京数字丝路智慧能源有限公司',
      mainCompanyNames: '北京数字丝路智慧能源有限公司',
      createTime: 1723025560000,
      creator: '1',
      creatorName: '超级管理员',
      taxCompanyName:
        '安徽德升容信息科技有限公司,安徽博诚鸿软件技术有限公司,安徽新荣达信息科技有限公司,安徽法尔贝数字信息科技有限公司,河南达新信息科技有限公司',
      platform: 0,
      signStatus: 2
    },
    {
      id: 134,
      contractNo: 'FLBFWXY20240802-0058',
      companyNo: 'JSCY0001202407311720190001',
      companyName: '营口仙人岛海洋生物科技有限公司',
      contractType: 1,
      signType: 1,
      externalContractNo: 'FLBFWXY20240802-0058',
      frameContractNo: null,
      frameContractName: null,
      contractStatus: 3,
      reason: null,
      expiresStart: '2024-08-02',
      expiresEnd: '2025-08-01',
      contractPath:
        'https://tyndall-saas-test.oss-cn-beijing.aliyuncs.com/jzq/pdf/jzq-contract/%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E4%B9%A6-FLBFWXY20240802-0058.pdf?Expires=1723716664&OSSAccessKeyId=LTAI5tFzSgkcjQoBsL8XCi13&Signature=%2B5qK%2B0%2BTNqrlJhslG%2B1odDe53E4%3D',
      downloadPath: 'jzq/pdf/jzq-contract/服务协议书-FLBFWXY20240802-0058.pdf',
      mainCompanyNo: 'MC20240509001',
      mainCompanyName: '北京数字丝路智慧能源有限公司',
      mainCompanyNames: '北京数字丝路智慧能源有限公司',
      createTime: 1722598236000,
      creator: '1',
      creatorName: '超级管理员',
      taxCompanyName:
        '安徽新荣达信息科技有限公司,安徽德升容信息科技有限公司,安徽法尔贝数字信息科技有限公司,安徽博诚鸿软件技术有限公司,河南达新信息科技有限公司',
      platform: 0,
      signStatus: 2
    },
    {
      id: 133,
      contractNo: 'FLBFWXY20240802-0057',
      companyNo: 'JSCY0001202406221720250001',
      companyName: '内蒙古谷农农牧业有限公司',
      contractType: 1,
      signType: 1,
      externalContractNo: 'FLBFWXY20240802-0057',
      frameContractNo: null,
      frameContractName: null,
      contractStatus: 3,
      reason: null,
      expiresStart: '2024-08-02',
      expiresEnd: '2025-08-01',
      contractPath:
        'https://tyndall-saas-test.oss-cn-beijing.aliyuncs.com/jzq/pdf/jzq-contract/%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E4%B9%A6-FLBFWXY20240802-0057.pdf?Expires=1723716664&OSSAccessKeyId=LTAI5tFzSgkcjQoBsL8XCi13&Signature=GYCalRIrZNqQNf1kDKTahA3HJNU%3D',
      downloadPath: 'jzq/pdf/jzq-contract/服务协议书-FLBFWXY20240802-0057.pdf',
      mainCompanyNo: 'MC20240509001',
      mainCompanyName: '北京数字丝路智慧能源有限公司',
      mainCompanyNames: '北京数字丝路智慧能源有限公司',
      createTime: 1722597872000,
      creator: '1',
      creatorName: '超级管理员',
      taxCompanyName:
        '安徽新荣达信息科技有限公司,安徽德升容信息科技有限公司,安徽法尔贝数字信息科技有限公司,安徽博诚鸿软件技术有限公司,河南达新信息科技有限公司',
      platform: 0,
      signStatus: 2
    },
    {
      id: 132,
      contractNo: 'FLBFWXY20240802-0056',
      companyNo: 'JSCY0001202408021858100002',
      companyName: '邯郸开发区宏正化工销售有限公司',
      contractType: 1,
      signType: 1,
      externalContractNo: 'FLBFWXY20240802-0056',
      frameContractNo: null,
      frameContractName: null,
      contractStatus: 3,
      reason: null,
      expiresStart: '2024-08-02',
      expiresEnd: '2025-08-01',
      contractPath:
        'https://tyndall-saas-test.oss-cn-beijing.aliyuncs.com/jzq/pdf/jzq-contract/%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E4%B9%A6-FLBFWXY20240802-0056.pdf?Expires=1723716664&OSSAccessKeyId=LTAI5tFzSgkcjQoBsL8XCi13&Signature=%2BqzRkwSOh8o3xcNTEWJb3cnmKjM%3D',
      downloadPath: 'jzq/pdf/jzq-contract/服务协议书-FLBFWXY20240802-0056.pdf',
      mainCompanyNo: 'MC20240509001',
      mainCompanyName: '北京数字丝路智慧能源有限公司',
      mainCompanyNames: '北京数字丝路智慧能源有限公司',
      createTime: 1722597737000,
      creator: '1',
      creatorName: '超级管理员',
      taxCompanyName:
        '安徽新荣达信息科技有限公司,安徽德升容信息科技有限公司,安徽法尔贝数字信息科技有限公司,安徽博诚鸿软件技术有限公司,河南达新信息科技有限公司',
      platform: 0,
      signStatus: 2
    },
    {
      id: 131,
      contractNo: 'FLBFWXY20240802-0055',
      companyNo: 'MC20240509001',
      companyName: null,
      contractType: 1,
      signType: 1,
      externalContractNo: 'FLBFWXY20240802-0055',
      frameContractNo: null,
      frameContractName: null,
      contractStatus: 3,
      reason: null,
      expiresStart: '2024-08-02',
      expiresEnd: '2025-08-01',
      contractPath:
        'https://tyndall-saas-test.oss-cn-beijing.aliyuncs.com/jzq/pdf/jzq-contract/%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E4%B9%A6-FLBFWXY20240802-0055.pdf?Expires=1723716664&OSSAccessKeyId=LTAI5tFzSgkcjQoBsL8XCi13&Signature=HSRrBJ47P%2Fssxs5D6ck0%2F6HFmTI%3D',
      downloadPath: 'jzq/pdf/jzq-contract/服务协议书-FLBFWXY20240802-0055.pdf',
      mainCompanyNo: 'MC20240509001',
      mainCompanyName: '北京数字丝路智慧能源有限公司',
      mainCompanyNames: '北京数字丝路智慧能源有限公司',
      createTime: 1722596930000,
      creator: '1',
      creatorName: '超级管理员',
      taxCompanyName:
        '安徽新荣达信息科技有限公司,安徽德升容信息科技有限公司,安徽法尔贝数字信息科技有限公司,安徽博诚鸿软件技术有限公司,河南达新信息科技有限公司',
      platform: 0,
      signStatus: 2
    },
    {
      id: 130,
      contractNo: 'FLBFWXY20240802-0054',
      companyNo: 'MC20240509001',
      companyName: null,
      contractType: 1,
      signType: 1,
      externalContractNo: 'FLBFWXY20240802-0054',
      frameContractNo: null,
      frameContractName: null,
      contractStatus: 3,
      reason: null,
      expiresStart: '2024-08-02',
      expiresEnd: '2025-08-01',
      contractPath:
        'https://tyndall-saas-test.oss-cn-beijing.aliyuncs.com/jzq/pdf/jzq-contract/%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E4%B9%A6-FLBFWXY20240802-0054.pdf?Expires=1723716664&OSSAccessKeyId=LTAI5tFzSgkcjQoBsL8XCi13&Signature=n3HEpnvTCeEmLABv5I1WvmJQHNA%3D',
      downloadPath: 'jzq/pdf/jzq-contract/服务协议书-FLBFWXY20240802-0054.pdf',
      mainCompanyNo: 'MC20240509001',
      mainCompanyName: '北京数字丝路智慧能源有限公司',
      mainCompanyNames: '北京数字丝路智慧能源有限公司',
      createTime: 1722596595000,
      creator: '1',
      creatorName: '超级管理员',
      taxCompanyName:
        '安徽新荣达信息科技有限公司,安徽德升容信息科技有限公司,安徽法尔贝数字信息科技有限公司,安徽博诚鸿软件技术有限公司,河南达新信息科技有限公司',
      platform: 0,
      signStatus: 2
    },
    {
      id: 129,
      contractNo: 'FLBFWXY20240802-0034',
      companyNo: 'JSCY0001202408021609270002',
      companyName: '中软信息系统工程有限公司',
      contractType: 0,
      signType: 1,
      externalContractNo: 'FLBFWXY20240802-0034',
      frameContractNo: null,
      frameContractName: null,
      contractStatus: 3,
      reason: null,
      expiresStart: '2024-08-02',
      expiresEnd: '2025-08-01',
      contractPath:
        'https://tyndall-saas-test.oss-cn-beijing.aliyuncs.com/jzq/pdf/jzq-contract/%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E4%B9%A6-FLBFWXY20240802-0034.pdf?Expires=1723716664&OSSAccessKeyId=LTAI5tFzSgkcjQoBsL8XCi13&Signature=MoU2QxTRya942S%2B7DOfnKA%2F8F5g%3D',
      downloadPath: 'jzq/pdf/jzq-contract/服务协议书-FLBFWXY20240802-0034.pdf',
      mainCompanyNo: 'MC20240509001',
      mainCompanyName: '北京数字丝路智慧能源有限公司',
      mainCompanyNames: '',
      createTime: 1722586971000,
      creator: '-1',
      creatorName: '系统创建',
      taxCompanyName: '',
      platform: 0,
      signStatus: null
    },
    {
      id: 128,
      contractNo: 'FLBFWXY20240802-0024',
      companyNo: 'JSCY0001202408021456090001',
      companyName: '新疆云梦泽农业有限责任公司',
      contractType: 0,
      signType: 1,
      externalContractNo: 'FLBFWXY20240802-0024',
      frameContractNo: null,
      frameContractName: null,
      contractStatus: 0,
      reason: null,
      expiresStart: '2024-08-02',
      expiresEnd: '2025-08-01',
      contractPath:
        'https://tyndall-saas-test.oss-cn-beijing.aliyuncs.com/jzq/pdf/jzq-contract/%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E4%B9%A6-FLBFWXY20240802-0024.pdf?Expires=1723716664&OSSAccessKeyId=LTAI5tFzSgkcjQoBsL8XCi13&Signature=QIhojzeLiI%2BIwFyDbRRJ4Zn4l6U%3D',
      downloadPath: 'jzq/pdf/jzq-contract/服务协议书-FLBFWXY20240802-0024.pdf',
      mainCompanyNo: 'MC20240509001',
      mainCompanyName: '北京数字丝路智慧能源有限公司',
      mainCompanyNames: '',
      createTime: 1722586050000,
      creator: '-1',
      creatorName: '系统创建',
      taxCompanyName: '',
      platform: 0,
      signStatus: null
    },
    {
      id: 127,
      contractNo: 'FLBFWXY20240802-0017',
      companyNo: 'JSCY0001202408011606170001',
      companyName: '哈密广云商贸有限责任公司',
      contractType: 0,
      signType: 1,
      externalContractNo: 'FLBFWXY20240802-0017',
      frameContractNo: null,
      frameContractName: null,
      contractStatus: 0,
      reason: null,
      expiresStart: '2024-08-02',
      expiresEnd: '2025-08-01',
      contractPath:
        'https://tyndall-saas-test.oss-cn-beijing.aliyuncs.com/jzq/pdf/jzq-contract/%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E4%B9%A6-FLBFWXY20240802-0017.pdf?Expires=1723716664&OSSAccessKeyId=LTAI5tFzSgkcjQoBsL8XCi13&Signature=vMMk%2BGrNAZ5k8F7GnVdjOD3mt28%3D',
      downloadPath: 'jzq/pdf/jzq-contract/服务协议书-FLBFWXY20240802-0017.pdf',
      mainCompanyNo: 'MC20240509001',
      mainCompanyName: '北京数字丝路智慧能源有限公司',
      mainCompanyNames: '',
      createTime: 1722584083000,
      creator: '-1',
      creatorName: '系统创建',
      taxCompanyName: '',
      platform: 0,
      signStatus: null
    }
  ],
  formConfig: { labelWidth: 120, schemas: searchFormSchema },
  useSearchForm: true,
  indexColumnProps: { fixed: 'left' },
  actionColumn: {
    width: '50px',
    title: `操 作`,
    dataIndex: 'action',
    fixed: 'right'
  }
});

const handleOpenLogSchema = record => {
  // openLogSchemaModal(true, { api: () => queryContractInfo(record.id) });
};
</script>

<template>
  <div style="background-color: #f5f5f5">
    <BasicTable @register="registerTable">
      <template #bodyCell="{ column, record, value }">
        <template v-if="column.key === 'action'">
          <TableAction :actions="[{ label: '查看', onClick: handleOpenLogSchema.bind(null, record) }]" />
        </template>
        <template v-else-if="['companyName'].includes(column.key as string)">
          <CButton
            style="padding: 0"
            data-table-button-ellipsis="true"
            type="link"
            @click="() => detailLogSchemaModalRef?.openModal(record.companyNo)"
            >{{ value }}</CButton
          >
        </template>
      </template>
    </BasicTable>
  </div>
</template>
